/**
 * 
 */
package GUI.main.renderers;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.border.LineBorder;

import GUI.helpers.ProjectConstants;

import officeserver.report.Treatment;

/**
 * @author mramsey3
 *
 */
public class TreatmentListRenderer extends JLabel implements ListCellRenderer{
    
    private static final long serialVersionUID = 1L;

    public Component getListCellRendererComponent(JList list, Object value,
	    int arg2, boolean isSelected, boolean arg4) {
	Treatment treatment = (Treatment) value;
	setText(treatment.toString());
	if (isSelected) {
	    setBackground(list.getSelectionBackground());
	    setForeground(list.getSelectionForeground());
	    setBorder(new LineBorder(ProjectConstants.BORDER_MAIN_COLOR,2));
	} else {
	    setBackground(list.getBackground());
	    setForeground(list.getForeground());
	    setBorder(new LineBorder(Color.white,2));
	}
	setEnabled(list.isEnabled());
	setFont(list.getFont());
	setOpaque(true);
	setPreferredSize(new Dimension(getWidth(), 52));

	return this;
    }

}
